/*
 ============================================================================
 Name		: TradeBlockAccount.h
 Author	  : spring xu
 Version	 : 1.0
 Copyright   : Your copyright notice
 Description : TradeFundAccount declaration
 ============================================================================
 */

#ifndef TRADEBLOCKQUERYACCOUNT_H
#define TRADEBLOCKQUERYACCOUNT_H

// INCLUDES
#include "TradeBlock.h"
#include "Control.h"
#include "TableWidget.h"
#include "TradeBlockNetwork.h"

// CLASS DECLARATION

class CTradeFundQueryAccount: public CTradeBlock, public MWidgetObserver, public MPushButtonObserver//,public MReqObserver
{
public:
    ~CTradeFundQueryAccount();

    static CTradeFundQueryAccount* NewL(CBaseBlock* bsBack = NULL);

    static CTradeFundQueryAccount* NewLC(CBaseBlock* bsBack);

private:
    CTradeFundQueryAccount(CBaseBlock* bsBack);

    void ConstructL();

public:
    void OnDraw(CFbsBitGc& g) const;

    void OnKeyDown(TInt keyCode);
    
    void OnMouseDown(const TPoint& aPt);
    
    void OnMouseMove(const TPoint& aPt);

    void OnMouseUp(const TPoint& aPt);

    void SizeChanged();    
    
    void ChangeFocus(TBool aFoucs, const TInt& keyCode);
    
public:
	void PushButtonClicked();
public:
    // from MWidgetObserver
    void UpdateScreen();
    void SelectOneRow(TInt aRowIndex);
    void LoseFocus(const TInt& keycode);
    
public:
	TBool ProcessTradeNetworkMsg(TInt nError, TAny* p, const TDesC8& aBodyData);
	//TBool UpdateTradeNetwork(TInt nProgress);

protected:
    void AddTabs();
    
private:
    void CreateTable();
    void CreateControls();
    void LayoutControls();
    
    void InitNetworkData();
	TBool AppendNetworkData(__ofAccount_record_info_t* pArray);
	
private:
	enum TNetworkStatus
	{
		ENetworkStatus_None,	
		ENetworkStatus_Req,
		ENetworkStatus_Resp,
	};
		
private:
    CTableWidget* iTable;
    
    CPushButton* 	iButtonMore;
    TInt			iFocusControl;
    
    TInt	iNetworkStatus;
	TInt    iNumberOfElement;
	TBool	iCanReq;
};

#endif // TRADEBLOCKQUERYFUNDS_H
